<?php
namespace App\Services;
use Illuminate\Support\Facades\Redis;
use GuzzleHttp\Client;
use App\Models\Task;
use Exception,Log,DB;


class CalltaskService
{
    //新用户注册后推送到电话后台
    public static function phonePush($phone)
    {
        $client = new Client();
        $url = "http://out.buft.cn/api/version/1/add_phone";
        $response = $client->request("post",$url,['json' => ['phone'=>$phone,'platform'=>'ttwl']]);
        $body = $response->getBody()->getContents();
        if($body = "SUCCESS"){
            $expected_time = time()+180;
            Task::createTask($phone,$expected_time);
        }
        return $body;
    }  
}
